/**
 * 合并样式
 * @param classNames 样式名称列表
 */
export function combineClassName(...classNames: (string | Record<string, boolean | undefined> | string[] | undefined)[]): string {
  const classNameList: string[] = [];

  classNames.forEach(item => {
    if (!item) {
      return;
    }
    if (typeof item === 'string') {
      classNameList.push(item);
      return;
    }
    if (Array.isArray(item)) {
      classNameList.push(...item);
      return;
    }

    for (const prop in item) {
      if (item[prop]) {
        classNameList.push(prop);
      }
    }
  });

  return Array.from(
    new Set(classNameList.map(item => item.trim()).filter(item => item)),
  ).join(' ');
}